import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;

public class Ticket {
    private String ticketId;
    private Show show;
    private List<Seat> seats;
    private double price;
    private boolean isRefunded;
    private LocalDateTime sellTime;

    public Ticket(Show show, List<Seat> seats, double price) {
        this.ticketId = UUID.randomUUID().toString().substring(0, 8);
        this.show = show;
        this.seats = seats;
        this.price = price;
        this.isRefunded = false;
        this.sellTime = LocalDateTime.now();
    }

    public boolean canRefund() {
        return LocalDateTime.now().isBefore(show.getTime().minusHours(1)) && !isRefunded;
    }

    public String getTicketId() { return ticketId; }
    public Show getShow() { return show; }
    public List<Seat> getSeats() { return seats; }
    public double getPrice() { return price; }
    public boolean isRefunded() { return isRefunded; }
    public void setRefunded(boolean refunded) { isRefunded = refunded; }
}